package phone.qyg.com.qyg.activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.TextView;

import com.app.base.tool.BaseActivity;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;

import java.util.ArrayList;
import java.util.List;

import phone.qyg.com.qyg.R;
import phone.qyg.com.qyg.adapter.MyFragmentPagerAdapter;
import phone.qyg.com.qyg.fragment.CulturalFiveFragment;
import phone.qyg.com.qyg.fragment.CulturalFourFragment;
import phone.qyg.com.qyg.fragment.CulturalOneFragment;
import phone.qyg.com.qyg.fragment.CulturalSixFragment;
import phone.qyg.com.qyg.fragment.CulturalThreeFragment;
import phone.qyg.com.qyg.fragment.CulturalTwoFragment;

/**
 * 文化超市
 */
@ContentView(R.layout.activity_cultural_mark)
public class CulturalMarkActivity extends BaseActivity {
    @ViewInject(R.id.back)
    TextView back;
    @ViewInject(R.id.tab)
    TabLayout tab;
    @ViewInject(R.id.viewpager)
    ViewPager viewPager;
    List<Fragment> list = new ArrayList<>();
    String[] titles = {"全部","艺术课堂","民族风情","民族历史","文化遗产","民间文化"};
    @Override
    public void initSucessView() {
        list.add(new CulturalOneFragment());
        list.add(new CulturalTwoFragment());
        list.add(new CulturalThreeFragment());
        list.add(new CulturalFourFragment());
        list.add(new CulturalFiveFragment());
        list.add(new CulturalSixFragment());
        MyFragmentPagerAdapter pagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager(),titles,list);
        viewPager.setAdapter(pagerAdapter);
        tab.setupWithViewPager(viewPager);
    }

    @Override
    public void initData(Bundle savedInstanceState) {

    }
    @Event(value = R.id.back)
    private void viewOnClick(View v){
        switch (v.getId()){
            case R.id.back:
                this.finish();
                break;
        }
    }
    @Override
    public void initViewHandler() {

    }
}
